package com.admin.common.scheduled;

import com.admin.service.DeclareUserService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/**
 * 申报用户
 * 申报状态，结果以及开关等
 */
@Slf4j
@Async
@Component
public class DeclareUserScheduledService {

    @Value("${constants.quart}")
    private Boolean quart;
    @Autowired
    private DeclareUserService declareUserService;

    @Scheduled(cron = "0 1/30 * * * ?")
    public void updateContractAmountScheduled() {
        if (quart == null || quart == false) {
            return;
        }
        log.info("DeclareUserScheduledService 更新用户申报信息 start");
        declareUserService.updateDeclareInfo();
        log.info("DeclareUserScheduledService 更新用户申报信息 end");
    }

}
